const joi = require('joi')
const userName = joi.string().alphanum().min(1).max(10).required()
const passWord = joi.string().pattern(/^[^\s]{6,12}$/).required();
const id = joi.number().integer().min(1).required()
const nickName = joi.string().required()
const email = joi.string().email().required()
const img = joi.string().dataUri().required()
exports.reg_login = {
    body: {
        userName,
        passWord
    }
}
exports.upDataUserinfo = {
    body: {
        id,
        nickName,
        email
    }
}
exports.upDataPWd = {
    body: {
        id: joi.number().required(),
        oldval: passWord,
        newval: joi.not(joi.ref('oldval')).concat(passWord)
    }
}
exports.img = {
    body: {
        id,
        img,
    }
}